<?php
namespace App\Traits;

//获取资源
use App\Http\Controllers\HandleRedis;

trait MessageInitParam
{
    protected static $AllXianhong = [];//所有限红

    protected static $AllPerCent = [];//所有赔率

    protected static $pid;

    protected static $showhao;

    protected static $content;

    protected static $room;

    protected static $page;

    protected static $limit;

    private static function allXianhong()
    {
        self::$AllXianhong = HandleRedis::getAllXianhong();
        //注册赔率
        self::allPerCent();
    }

    /**
     * 所有赔率
     */
    protected static function allPerCent()
    {
        //可动态改变概率(暂时写死)
        self::$AllPerCent = [
            'z' => 0.95,
            'x' => 1,
            'h' => 8,
            'zd' => 11,
            'xd' => 11,
            'zx_xima' => 1,
            'all_zx_xima_wx' => 1,
            'all_sb_xima' => 1,
        ];
    }

    /**
     * 初始化参数
     * @param array $request
     */
    protected static function requestParam($request = [])
    {
        self::$pid = requestData('pid',0,'int');
        self::$showhao = requestData('showhao','','string');
        self::$content = requestData('content','','string');
        self::$room = requestData('room','','string');
        self::$page = requestData('page',1,'int');
        self::$limit = requestData('limit',10,'int');
    }
}
